#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'

//全排列空间 n^n> n!>2^n> n^k
//4^4=256 >>4! =24 >> 2^4=16 >= 2^2=4
int main() {
    for (int a = 1; a <= 4; a++)
        for (int b = 1; b <= 4; b++)
            for (int c = 1; c <= 4; c++)
                for (int d = 1; d <= 4; d++) {
                    if (a == b || a == c || a == d || b == c || b == d || c == d)continue;
                    cout << a << b << c << d << endl;

                }
    return 0;
}
